import * as React from "react";
import PropTypes from "prop-types";

export default class PropsTypeDemo extends React.Component {
  render() {
    return (
      <div>
        <h1>使用 PropTypes 进行类型检查</h1>
        <h2>{this.props.title}</h2>
      </div>
    );
  }
}
PropsTypeDemo.propTypes = {
  title: PropTypes.number,
  requiredFunc: PropTypes.func.isRequired, // 必选项
};
PropsTypeDemo.defaultProps = {
    title: 'Stranger'
};
